<style scoped lang="scss">
.delete-button {
    height: 100%;
    width: 100px;
}
.cell{
    dl{
        padding: 10px;
        display: flex;
        border: 2px solid #ccc;
        border-top-left-radius: 20px;
        border-bottom-left-radius: 20px;
        margin: 10px 0;
        margin-left: 10px;
        dd{
            margin-left: 10px;
            // margin-top: 10px;
            .topp{
                align-items: center;
                display: flex;
                span{
                    margin-left: 10px
                }
            }
            p{
                line-height: 35px;
            }
        }
    }
}
</style>
<template>
    <div>
        <homeTop :showicon1="false" :showicon2="true" :showbar7="true"></homeTop>
        <van-swipe-cell class="cell"v-for="(item, index) in interestData" :key="index">
            <dl>
                <dt>
                    <img style="width: 100px;height: 100px;" :src="item.imagePic" alt="">
                </dt>
                <dd>
                    <p class="topp">
                        <h4>{{ item.name }}</h4>
                        <span>{{ item.jobTitle }}</span>
                    </p>
                    <p>
                        <span>{{ item.inauguralHospital }}</span>
                    </p>
                    <p>
                        <span>好评率{{ item.praise }}</span>
                        &emsp;&emsp;
                        <span>服务患者数{{ item.number }}</span>
                    </p>
                </dd>
            </dl>
            <template #right>
                <van-button @click="onqx(item.doctorId)" square text="取消关注" type="danger" class="delete-button" />
            </template>
        </van-swipe-cell>
    </div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { getInterest,getcancel } from '../../api';
import homeTop from '@/components/homeTop/index.vue'
const userId = ref(JSON.parse(localStorage.getItem('userId') as string))
const sessionId = ref(JSON.parse(localStorage.getItem('sessionId') as string))
const interestData:any = ref([])
const config = {
    page: 1,
    count: 10
}
const InterestList = async () => {
    const res = await getInterest(userId.value, sessionId.value, config)
    interestData.value = res.data.result
    console.log(res, 'getInterestgetInterestgetInterest');
}
InterestList()
const onqx =async (doctorId: any) => {
    console.log(doctorId, 'doctorId');
    const res=await getcancel(userId.value, sessionId.value, doctorId)
    console.log(res,'getcancelgetcancelgetcancelgetcancel');
    InterestList()
}
</script>